package com.yootk.action;

import com.yootk.vo.Message;
import com.yootk.webflux.handler.MessageHandler2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/message/*")
public class MessageAction {

    @Autowired
    private MessageHandler2 messageHandler;     // WebFlux处理程序

    @RequestMapping("echo")
    public Object echo(Message message) {
        log.info("接收用户访问信息，用户发送的参数为：message = {}", message);
        return messageHandler.echoHandler(message);
    }

    @RequestMapping("list")
    public Object list(Message message) {
        log.info("接收用户访问信息，用户发送的参数为：message = {}", message);
        return messageHandler.listHandler(message);
    }

    @RequestMapping("map")
    public Object map(Message message) {
        log.info("接收用户访问信息，用户发送的参数为：message = {}", message);
        return messageHandler.mapHandler(message);
    }
}
